import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;

import java.util.*;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: Administrator
 * \* Date: 2021/11/30
 * \* Time: 19:04
 * \* To change this template use File | Settings | File Templates.
 * \* Description:
 * \
 */

public class TestDemo3 {

    public static void main(String[] args) {
        Map<String,String> map=new HashMap<>();
        System.out.println("大小为："+map.size());
        System.out.println("集合为空吗？"+ map.isEmpty());
        map.put("国民男神","朱先生");//放元素
        map.put("齐天大圣","孙悟空");
        //根据k获取value值是啥
        String ret=map.get("齐天大圣");
        //假如没有，返回自定义值
        String ret1=map.getOrDefault("adfa","牛魔王");
        System.out.println(ret);
        //是否包含内容
        boolean flg=map.containsKey("国民男神");
        System.out.println(flg);

    }
    public static void main2(String[] args) {
        Collection<String> list = new ArrayList<>();
        System.out.println(list.size());//打印集合中的元素
        System.out.println(list.isEmpty());//判断是否为空
        list.add("我");//增加元素
        list.add("是");
        list.add("超人");
        System.out.println(list.size());//打印集合中的元素
        System.out.println(list.isEmpty());//判断是否为空
        Object[] array = list.toArray();//变为数组
        System.out.println(Arrays.toString(array));//打印数组
        for (String s : list) { System.out.println(s);
        }
        list.remove("是");//移除元素
        for (String s : list) {
            System.out.println(s);
        }
        list.clear();//清空所有元素
        System.out.println(list.size());
        System.out.println(list.isEmpty());
    }

    public static void main1(String[] args) {
        int [] arr={1,2,3,4,5};
        int [] arr1={1,2,3,4,5,6};

//        System.out.println(arr.length);
//        for (int i=0;i<arr.length;i++){
//            System.out.print(arr1[i]+" ");
//        }
    }
}
